<template>
	<view >
		<view  class="" @click="get()">
			<view  style=" margin:55rpx; font-size: 45rpx;">
					<uni-card :is-shadow="false">
								<text class="uni-body">党费已经缴纳</text>
							</uni-card>
			</view>
		   	<view class="button-sp-area"  style=" margin:58rpx;">
	  				<button class="mini-btn" type="primary" size="mini">详情</button>
	  			</view>
		</view>
	</view>
</template>

<script>
	import {
	   SelectIfPays,
	   MyPayTydue
	} from "@/api/home/home.js"
	export default {
		props:[],
		data() {
			return {
				userId:'',
			}
		},
		methods: {
			get(){
				console.log(this.userId);
			}
		},
		onLoad(options) {
				uni.navigateBack({
							delta:2
						})
			this.userId = options.userId;
		    SelectIfPays(options.userId).then(res=>{
				if(res.data==1){
			uni.showModal({
				title: '缴费',
				content: '是否确认缴费',
				success: (res) => {
					if (res.confirm) {
						MyPayTydue(this.userId).then(res=>{
							if(res.data){
								uni.navigateTo({
									url: '/pages/pay-due/pay/pay'
								})
							}else{
								uni.switchTab({
									url: '/pages/index'
								});
							}
						})
							
					} else if (res.cancel) {
						
					}
				}
			});
				}else if(res.data==0){
					uni.showModal({
						title: '已缴费',
						content: '是否跳转党费记录界面',
						success: (res) => {
							if (res.confirm) {
								
									uni.navigateTo({
										url: '/pages/mine/mypartydues/mypartydues'
									})
							} else if (res.cancel) {
								uni.switchTab({
									url: '/pages/index'
								});
							}
						}
					});
				}
				
			})
		},
	}
</script>

<style>

</style>
